﻿using MyBasicLib.Extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;
using System.Collections.Generic;

namespace MyBasicLib.Test
{
    
    
    /// <summary>
    ///This is a test class for EnumerableExtensionTest and is intended
    ///to contain all EnumerableExtensionTest Unit Tests
    ///</summary>
    [TestClass()]
    public class EnumerableExtensionTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion
        //[TestMethod]
        //public void CompressTest()
        //{
        //    var list0 = new List<int>() { 0, 1, 3, 5 };
        //    var list1 = new List<int>() { 0, 1, 3, 5 };
        //    var list2 = new List<int>() { 0, 0, 1, 1, 3, 3, 3, 5, 5 };
        //    var r = list1.Compress((x, y) => x == y);
        //    var idx = 0;
        //    Assert.AreEqual(4, r.Count());

        //    foreach (var i in r)
        //    {
        //        Assert.AreEqual(i, list0[idx++]);
        //    }
        //    r = list2.Compress((x, y) => x == y);
        //    idx = 0;
        //    Assert.AreEqual(4, r.Count());

        //    foreach (var i in r)
        //    {
        //        Assert.AreEqual(i, list0[idx++]);
        //    }
        //}
        //[TestMethod]
        //public void CompressTest1()
        //{
        //    var list0 = new List<int>() { 0, 1 ,1};
        //    var list1 = new List<int>() { 0, 1, 1, 1 };
        //    var r = list1.Compress((x, y) => x == y);
        //    var idx = 0;
        //    Assert.AreEqual(3, r.Count());

        //    foreach (var i in r)
        //    {
        //        Assert.AreEqual(i, list0[idx++]);
        //    }
        //}
        //[TestMethod]
        //public void CompressTest2()
        //{
        //    var list0 = new List<int>() { 1, 1 };
        //    var list1 = new List<int>() { 1, 1, 1, 1 };
        //    var r = list1.Compress((x, y) => x == y);
        //    var idx = 0;
        //    Assert.AreEqual(2,r.Count());
        //    foreach (var i in r)
        //    {
        //        Assert.AreEqual(i, list0[idx++]);
        //    }
        //}
    }
}
